package com.chapter03;

import com.bdqn.util.JDBCUtils;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class Test06_Insert_ps {
    public static void main(String[] args) throws SQLException, ClassNotFoundException {
        Connection connection = JDBCUtils.getConnection();

        String sql = "insert into grade VALUES(?,?);";
        PreparedStatement preparedStatement = connection.prepareStatement(sql);
        preparedStatement.setObject(1,104);
        preparedStatement.setObject(2,"你猜");

        int i = preparedStatement.executeUpdate();
        if (i > 0) {
            System.out.println("插入成功");
        }

        preparedStatement.close();
        connection.close();
    }
}
